Repository navigation
feat(pii): add opt-in PII redaction with streaming rehydration - #58
Conversation
Opted-in routes and key scopes replace detected emails, phones and cards with request-local HMAC placeholders before dispatch and restore them in JSON and SSE responses. Maps live only in request memory, redacted requests bypass caches and idempotency replay, and both settings default to off.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
multillm-proxy | 84d76ff | Oct 09 2026, 02:49 AM |
7198a88
into
integrate/gateway-waves-1-4
Summary
Adds opt-in PII redaction with streaming rehydration. With
PII_REDACTION_ENABLEDoff andPII_REDACTION_POLICY_JSON={}(the defaults), and for any route or key scope that isn't opted in, requests and responses are unchanged.email,phone,card) and a mode (requiredorbest_effort)./v1/chat/completions,/v1/messages,/v1/responsesand/intelligence/v1/chat/completionsin Flask, plus/v1/roleplay/chat/completionsin the Worker. Raw provider passthrough is never transformed.__MLPII_<64 hex>__: HMAC-SHA-256 of the value under a random 32-byte secret made for that request.requiredmode (the default), a redaction failure returns 422pii_redaction_failedbefore dispatch.best_effortmode, the unchanged, firewall-checked payload is sent instead.pii_rehydration_failed.Idempotency-Keyreturns 400pii_idempotency_unsupportedbefore dispatch. Requests with no PII keep their existing behavior.Idempotency-Keyupstream, sendCache-Control: no-store, and reportcacheable: false, replayable: false.Details are in
docs/pii-rehydration.md.Shared registrations
tests/test_pii_rehydration_worker.mjsintest:worker, plus test loader mappings for the two new roleplay transport imports.worker/pii-redaction.mjsandworker/pii-rehydration.mjsin the edge module inventory.worker/roleplay/transport.mjs, up from 3. The new one is the Container fetch in the PII submit callback, which runs insidefirewallFetch.PII_REDACTION_ENABLEDandPII_REDACTION_POLICY_JSONin the Container env keys.Left for the Wave 5 integration
services/gateway_extensions.py: registerregister_pii_redactionafter retention and deadline, before the idempotency claim. Until then, the Flask hook isn't active.worker/roleplay/endpoint.mjs:piiKeyScope;onPIIDecision, so redacted turns aren't cached or replayed;no-storeon the final response.Until then, roleplay redaction applies only through route opt-in.
README line.
Tests
tests/test_pii_rehydration.pyandtests/test_pii_rehydration_worker.mjscover:npm run test:worker: 1,504 passed.npm run test:integration: 7 passed.test:deploy, free routes, client headers and thewrangler deploy --dry-runbundle all pass.tests/test_frontend_build.mjsfails locally because@tailwindcss/cliis not installed. It fails the same way on main.CI notes
python/nodejobs: the dependency-audit steps fail on every branch, including main. fix(deps): clear the CI dependency audit advisories #42 fixes that.AdmissionCoordinatorDurable Object migration, whichwrangler versions uploadcannot apply. This is expected untilwrangler deployruns on main.This is part of Wave 5. It is based on
integrate/gateway-waves-1-4, the Wave 4 integration branch. The README line comes with the Wave 5 integration PR.